﻿package mortal.game.view.godLuckGift.data
{
    import Message.DB.Tables.*;
    import Message.Public.*;
    import flash.geom.*;
    import mortal.game.*;
    import mortal.game.cache.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.scene3D.ai.*;

    public class GodLuckGiftUtil extends Object
    {
        public static const CollectMapId:int = 10100;
        public static const mapX:int = 5375;
        public static const mapY:int = 4331;
        public static var coin:int;
        public static var gold:int;
        public static var items:Array = [];
        public static var itemObj:Object = {};
        public static var giftLen:int = 5;
        public static var isStar:Boolean = false;

        public function GodLuckGiftUtil()
        {
            return;
        }// end function

        public static function clear() : void
        {
            coin = 0;
            gold = 0;
            items = [];
            itemObj = {};
            return;
        }// end function

        public static function gotoCollect() : void
        {
            AIManager.cancelAll();
            AIManager.addMoveToOtherMap(Game.mapInfo.mapId, CollectMapId, new Point(mapX, mapY));
            AIManager.start();
            return;
        }// end function

        private static function toAddFightBoss(param1:Object = null) : void
        {
            AIManager.addAutoFight(-1, null);
            return;
        }// end function

        public static function onFlyHd() : void
        {
            var _loc_1:* = new SPassTo();
            _loc_1.mapId = CollectMapId;
            _loc_1.toPoint = new SPoint();
            _loc_1.toPoint.x = mapX;
            _loc_1.toPoint.y = mapY;
            var _loc_2:* = Cache.instance.pack.backPackCache.getItemCountByCategoryAndType(EGroup._EGroupProp, EProp._EPropProp, EPropType._EPropTypeConvey);
            if (Cache.instance.vip.freeFlyBootTimes == 0 && _loc_2 <= 0)
            {
                GameController.guide.buyFlyBoot(_loc_1);
                AIManager.addMoveTo(new Point(mapX, mapY));
            }
            else
            {
                AIManager.addFlyBoot(_loc_1);
            }
            AIManager.start();
            return;
        }// end function

        public static function getRewardArr() : Array
        {
            var _loc_7:SPlayerItem = null;
            var _loc_8:ItemData = null;
            var _loc_1:* = DailyConfig.instance.getDailyItem(2014);
            var _loc_2:* = _loc_1.reward;
            var _loc_3:* = _loc_2.split("#");
            var _loc_4:Array = [];
            var _loc_5:int = 0;
            while (_loc_5 < _loc_3.length)
            {
                
                _loc_7 = new SPlayerItem();
                _loc_7.itemCode = int(_loc_3[_loc_5]);
                _loc_7.itemAmount = 1;
                _loc_8 = new ItemData(_loc_7);
                _loc_4.push(_loc_8);
                _loc_5++;
            }
            var _loc_6:Array = [_loc_4.slice(0, 4), _loc_4.slice(4, _loc_4.length)];
            return _loc_6;
        }// end function

        public static function getTestItems() : Array
        {
            var _loc_2:ItemData = null;
            var _loc_1:Array = [];
            var _loc_3:int = 0;
            while (_loc_3 < 5)
            {
                
                _loc_2 = new ItemData(410121001 + _loc_3);
                _loc_1.push(_loc_2);
                _loc_3++;
            }
            _loc_2 = new ItemData(410401001);
            _loc_1.push(_loc_2);
            return _loc_1;
        }// end function

    }
}
